package com.taofuxn.yycreazy.ui.base;

import android.content.Context;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.WindowManager;

import com.taofuxn.yycreazy.R;
import com.taofuxn.yycreazy.util.AppStyleUtil;

import butterknife.ButterKnife;
import butterknife.InjectView;

/*
 * Created by wanghuafu on 16/9/15.
 */

public abstract class BaseActivity extends AppCompatActivity {

    private AppStyleUtil mStyleUtil;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mStyleUtil = new AppStyleUtil();
        mStyleUtil.aotoLoadStyleTheme(this);

        setContentView(setContentLayout());
        ButterKnife.inject(this);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        if (toolbar != null)
            setSupportActionBar(toolbar);


        init();
    }


    protected abstract int setContentLayout();

    protected abstract void init();


    public void switchThemeTo(AppStyleUtil.StyleType mStyleType) {
        mStyleUtil.switchThemeTo(mStyleType, this);
    }

    @Override
    protected void onResume() {
        super.onResume();

    }

    @Override
    protected void onDestroy() {
        mStyleUtil.onDetroy();
        super.onDestroy();
    }

}
